package com.cll.pmis.mapper;

import com.baomidou.mybatisplus.plugins.Page;
import com.cll.pmis.entity.Drug;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author chenliangliang
 * @since 2018-06-18
 */
public interface DrugMapper extends BaseMapper<Drug> {

    /**
     * 冻结库存
     * @param drugId
     * @param freeze
     * @return
     */
    int freezeNum(@Param("drugId") Integer drugId,@Param("freeze") Integer freeze);


    /**
     * 扣库存
     * @param drugId
     * @param num
     * @return
     */
    int deductNum(@Param("drugId") Integer drugId,@Param("num") Integer num);


    List<Map<String,Object>> queryDrugTakeByPage(@Param("time") String time,
                                                 @Param("username") String username,
                                                 @Param("phone") String phone,
                                                 @Param("dossierId") Integer dossierId,
                                                 @Param("status") Integer status, Page page);

    List<String> listCompany(@Param("query") String query);

    List<Map<String,Object>> queryDrugName(@Param("drugName") String drugName);
}
